package com.firebird.app.kotlin.stock.utils

import android.app.AlertDialog
import android.app.Dialog
import android.content.Context
import android.view.LayoutInflater
import android.view.View
import com.firebird.app.kotlin.stock.R


/**
 * Created by ljk on 2019/4/25.
 */
object DialogUtils {
    fun showDialog_progressbar(context: Context?): Dialog {
        val dialog = AlertDialog.Builder(context, R.style.MyCustomDialog).create()
        val view: View = LayoutInflater.from(context).inflate(R.layout.dialog_view, null, false)
        dialog.setView(view)
        dialog.setCanceledOnTouchOutside(false)
        //背景透明
        dialog.window.setBackgroundDrawableResource(R.color.transparent)
        dialog.show()
        return dialog
    }

    fun closeDialog(mDialogUtils: Dialog?) {
        if (mDialogUtils != null && mDialogUtils.isShowing) {
            mDialogUtils.dismiss()
        }
    }
}